import React, { useEffect, useState } from 'react'
import api from '@/api'
import {
    Space, Table, Tag, Image, Button, Drawer, message,
    Cascader,
    Checkbox,
    DatePicker,
    Form,
    Input,
    InputNumber,
    Radio,
    Select,
    Switch,
    TreeSelect,
    Upload,
    Pagination,
    Card
} from 'antd';
import type { ColumnsType } from 'antd/es/table';
import { SearchOutlined, EditOutlined, CloseOutlined, PlusOutlined } from '@ant-design/icons';
export default function OrderProcess() {
    const [list, setLisst] = useState([])
    async function getHandelList() {
        const res = await api.worker.getHandleList()
        setLisst(res.data.data)
        console.log(res.data.data);

    }
    useEffect(() => {
        getHandelList()
    }, [])
    const columns: ColumnsType<any> = [
        {
            title: '服务名',
            dataIndex: 'servegoodsname',
            key: 'servegoodsname'
        },
        {
            title: '老板姓名',
            dataIndex: 'username',
            key: 'username'
        },
        {
            title: '老板电话',
            dataIndex: 'phone',
            key: 'phone'
        },
        {
            title: '老板地址',
            dataIndex: 'location',
            key: 'location'
        },
        {
            title: '完成期限',
            dataIndex: 'endtime',
            key: 'endtime'
        },
        {
            title: '确认完成',
            render: (_, item) => {
                return (<Button type='primary' onClick={() => { confrims(item.id) }}>已完成</Button>)
            }

        }


    ]
    async function confrims(args: any) {
        const res = await api.worker.confirmOrder({ id: args })
        console.log(res);
        getHandelList()


    }
    return (

        <Card>

            <Table columns={columns} dataSource={list} pagination={false}></Table>
        </Card >

    )
}
